using System.Collections.Generic;

namespace SiliverlightJavascriptIntelli
{
    public class SilverlightParameterCollection : List<SilverlightParameter>
    {
        public override bool Equals(object obj)
        {
            SilverlightParameterCollection other = obj as SilverlightParameterCollection;
            if (other != null)
            {
                return this.TrueForAll(delegate(SilverlightParameter curParameter)
                                           {
                                               return other.Exists(delegate(SilverlightParameter otherParameter)
                                                                       {
                                                                           return curParameter == otherParameter;
                                                                       });
                                           }); 
            }
            else
                return base.Equals(obj);

        }

        public static bool operator ==(SilverlightParameterCollection x, SilverlightParameterCollection y)
        {
            bool isEqual;
            if (object.ReferenceEquals(x, null))
            {
                if (object.ReferenceEquals(y, null))
                {
                    isEqual = true;
                }
                else
                {
                    isEqual = false;
                }
            }
            else
            {
                isEqual = x.Equals(y);
            }
            return isEqual;
        }


        public static bool operator !=(SilverlightParameterCollection x, SilverlightParameterCollection y)
        {
            return !(x == y);
        }
    }
}